package com.jiazhong.shixi.controller;

import com.jiazhong.shixi.bean.Bingren;
import com.jiazhong.shixi.mapper.BingrenMapper;
import com.jiazhong.shixi.util.JsonResult;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@CrossOrigin("*")
@RestController
@RequestMapping("/bingr")
public class BingrenController {
    @Resource
    private BingrenMapper bingrenMapper;

    @RequestMapping("/guahao")
    public JsonResult guahao(Bingren bingren) {
        System.out.println(bingren);
        Bingren b = bingrenMapper.add(bingren);
        JsonResult result = new JsonResult(true, 200,"挂号成功","");
        return fanhui(bingren.getBinShenfenzheng());
    }
    public JsonResult fanhui(long sfz){
        List<Bingren> list = bingrenMapper.fanhui(sfz);
        JsonResult result1 = new JsonResult(true,201,list,"挂号成功");
        return result1;
    }
}
